Skip to content

Conversation

@huydhn
Copy link
Contributor

@huydhn huydhn commented Jan 10, 2024

All files used to build the Docker image needs to be in .ci/docker older so that the image hash is updated correctly when they change. The good news is that links can be setup to refer to them from other locations. This complication is partly due to Docker build rule to only access files under its build folder, a.k.a .ci/docker

I move some file around in this PR as follows:

git mv requirements-lintrunner.txt .ci/docker
ln -s .ci/docker/ requirements-lintrunner.txt

cd examples/arm
git mv setup.sh ../../.ci/docker/examples/arm/setup.sh
ln -s ../../.ci/docker/examples/arm/setup.sh setup.sh

git mv ethos-u-setup ../../.ci/docker/examples/arm/ethos-u-setup
ln -s ../../.ci/docker/examples/arm/ethos-u-setup ethos-u-setup

This workaround allows people to edit files in examples/arm as usual because they link to the source files under .ci/docker while updating the Docker image hash correctly.

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 10, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/1574

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (5 Unrelated Failures)

As of commit 559cd99 with merge base 52a4cec (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 10, 2024
@huydhn huydhn changed the title Move arm setup script into .ci/docker and create links to them Move arm setup scripts into .ci/docker and create links to them Jan 10, 2024
@huydhn huydhn requested review from Jerry-Ge and guangy10 January 10, 2024 03:45
@facebook-github-bot
Copy link
Contributor

@huydhn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@huydhn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@@ -0,0 +1,246 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we want to move examples dir under docker. This was meant as an example for the end user, it happens to be a good setup for CI.

Copy link
Contributor Author

@huydhn huydhn Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree on this point, it looks weird having a bunch of scripts under .ci/docker/examples/arm, so I try to think of them as installation scripts to setup arm job and see how it goes.

There are some rules w.r.t. the building of Docker images:

  • Only .ci/docker folder is taken into account per convention. This PR tries to follow this rule, but it looks bad in this case.
  • The rebuilding of the Docker image happens. But because its hash version, calculated by DOCKER_TAG=$(git rev-parse HEAD:"${DOCKER_BUILD_DIR}"), doesn't change, the image becomes stale.

I think I'll keep this PR around just in case, and see if I can bend the second rule instead to force update the image. Note that force update, even if it could be done, can only be an optional choice because not overwriting an existing image helps CI reliability from my experience.

@huydhn huydhn marked this pull request as draft January 10, 2024 18:27
huydhn added a commit to pytorch/test-infra that referenced this pull request Jan 23, 2024
IIRC, we used to have this option, but nothing was using it. I have
found an use case for this in
pytorch/executorch#1335 (comment)
where ExecuTorch team copies the content of `examples/arm` into
`.ci/docker` before starting the build
https://github.com/pytorch/executorch/blob/main/.ci/docker/build.sh#L40-L46:

* The docker image was rebuilt, but its hash tag remained the same
because the copy step above is not version tracked.
* The new image was not pushed.

I have tried to move `examples/arm` into `.ci/docker` and setup
softlinks, but the result looks weird
pytorch/executorch#1574 (comment),
so I'll probably drop that approach.

The remaining option here is to add a `force-push` flag that can be used
to, well, force push the image even if its hash tag already exists.
facebook-github-bot pushed a commit that referenced this pull request Jan 23, 2024
Summary:
Instead of #1574, the other option to resolve the stale Docker image issue from #1335 (comment) is to use the new `force-push` flag added by pytorch/test-infra#4866.  This ensures that a rebuilt image will always be pushed upstream even if its hash tag already exists.

### Testing

With the new GH action, the image is pushed correctly https://github.com/pytorch/executorch/actions/runs/7483947498/job/20369991072?pr=1582#step:6:49039

Pull Request resolved: #1582

Reviewed By: digantdesai

Differential Revision: D52684112

Pulled By: huydhn

fbshipit-source-id: a7642c47be3681129802a4405e5cdcdc2b328560
@huydhn huydhn closed this Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants